/**
 * 推广模块
 */
import { service, paramsQuery } from './request';

// 左侧菜单
export function fetchGeneralizeSide(param) {
  let ret = paramsQuery('/manage/api/bus/page/tgleftnav', param);
  return service.get(ret.path, ret.body);
}

// 广告计划/列表
export function fetchPlanList(param) {
  let ret = paramsQuery('/manage/api/bus/plan/getlist', param);
  return service.post(ret.path, ret.body);
}

// 广告计划/状态变更
export function fetchPlanStatus(param) {
  let ret = paramsQuery('/manage/api/bus/plan/status', param);
  return service.post(ret.path, ret.body);
}

// 广告计划/删除
export function fetchPlanRemove(param) {
  let ret = paramsQuery('/manage/api/bus/plan/delete', param);
  return service.post(ret.path, ret.body);
}

// 广告计划/添加
export function fetchPlanAdd(param) {
  let ret = paramsQuery('/manage/api/bus/plan/add', param);
  return service.post(ret.path, ret.body);
}

// 广告计划/更新
export function fetchPlanUpdate(param) {
  let ret = paramsQuery('/manage/api/bus/plan/update', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/列表
export function fetchUnitList(param) {
  let ret = paramsQuery('/manage/api/bus/unit/getlist', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/状态变更
export function fetchUnitStatus(param) {
  let ret = paramsQuery('/manage/api/bus/unit/status', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/设置盈利比
export function fetchUnitProfit(param) {
  let ret = paramsQuery('/manage/api/bus/unit/setearnings', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/历史盈利比
export function fetchUnitHistoryProfit(param) {
  let ret = paramsQuery('/manage/api/bus/unit/getearnings', param);
  return service.get(ret.path, ret.body);
}

// 广告单元/设置曝光数比
export function fetchUnitExposure(param) {
  let ret = paramsQuery('/manage/api/bus/unit/setexposure', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/历史曝光数比
export function fetchUnitHistoryExposure(param) {
  let ret = paramsQuery('/manage/api/bus/unit/getexposure', param);
  return service.get(ret.path, ret.body);
}

// 广告单元/查询单元
export function fetchUnitDetail(param) {
  let ret = paramsQuery('/manage/api/bus/unit/getbyid', param);
  return service.get(ret.path, ret.body);
}

// 广告单元/新增
export function fetchUnitAdd(param) {
  let ret = paramsQuery('/manage/api/bus/unit/add', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/更新
export function fetchUnitUpdate(param) {
  let ret = paramsQuery('/manage/api/bus/unit/update', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/删除
export function fetchUnitRemove(param) {
  let ret = paramsQuery('/manage/api/bus/unit/delete', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/更新每日预算
export function fetchUnitUpdateBudget(param) {
  let ret = paramsQuery('/manage/api/bus/unit/update_budget', param);
  return service.post(ret.path, ret.body);
}

// 广告单元/更新出价
export function fetchUnitUpdatePrice(param) {
  let ret = paramsQuery('/manage/api/bus/unit/update_default_price', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/列表
export function fetchCreativeList(param) {
  let ret = paramsQuery('/manage/api/bus/creative/getlist', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/状态变更
export function fetchCreativeStatus(param) {
  let ret = paramsQuery('/manage/api/bus/creative/status', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/删除
export function fetchCreativeRemove(param) {
  let ret = paramsQuery('/manage/api/bus/creative/delete', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/新增
export function fetchCreativeAdd(param) {
  let ret = paramsQuery('/manage/api/bus/creative/add', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/更新
export function fetchCreativeUpdate(param) {
  let ret = paramsQuery('/manage/api/bus/creative/update', param);
  return service.post(ret.path, ret.body);
}

// 广告创意/详情
export function fetchCreativeDetail(param) {
  let ret = paramsQuery('/manage/api/bus/creative/getbyid', param);
  return service.get(ret.path, ret.body);
}

// 广告创意模板：信息流0，图片1，视频2，文字3
export function fetchCreativeTemplate(param) {
  let ret = paramsQuery('/manage/api/bus/page/gettemplatebyid', param);
  return service.get(ret.path, ret.body);
}
